<template>
    <div class="wrapper">
        <div class="left-page">
            <Search v-on:onSearch="onSearch" />
            <div class="cell-row">
                <DBRow/>
                <YYRow/>
            </div>
            <div class="cell-row">
                <BSRow/>
            </div>
        </div>
        <div class="right-page">
            <MyStat/>
            <TakeNumber/>
            <BJStat/>

        </div>
        <RegisterDialog :disabledWindow = "true" title = "受理登记" v-on:onSubmit="onSubmit" />
    </div>
</template>
<script>
import Pubsub from "../../utils/pubsub";

import LabelRow from "../../components/acceptWorkbench/labelRow.vue";
import DBRow from "../../components/acceptWorkbench/dbRow.vue"; //待办事项
import YYRow from "../../components/acceptWorkbench/yyRow.vue"; //预警提醒
import BSRow from "../../components/acceptWorkbench/bsRow.vue"; //办事指南
import MyStat from "../../components/acceptWorkbench/myStat.vue"; //我的统计
import TakeNumber from "../../components/acceptWorkbench/takeNumber.vue"; //取号情况
import BJStat from "../../components/acceptWorkbench/bjStat.vue"; //办件统计
import Search from "../../components/common/search.vue"; //搜索
import RegisterDialog from "../../components/common/registerDialog"; //新增弹窗

import { addYwHandle } from "../../config/api";
export default {
    components: {
        LabelRow,
        DBRow,
        YYRow,
        BSRow,
        MyStat,
        TakeNumber,
        BJStat,
        Search,
        RegisterDialog
    },
    data() {
        return {
            searchList: [],
            guidList: [1, 2]
        };
    },
    mounted() {
         this.pubsub_token1 = Pubsub.subscribe("CALLING",(t,args)=>{
            Pubsub.publish(
                "showRegisterDialog",
                {type:"ywsl",handleType:"workbench",...args}
                );
        })
    },
    destroyed(){
        this.pubsub_token1 && Pubsub.unsubscribe(this.pubsub_token1);
    },
    methods: {
        //新增确定按钮回调函数
        onSubmit(request) {
            addYwHandle(request).then(() => {
                Pubsub.publish("hideRegisterDialog");
                this.$message({
                    message: "操作成功",
                    type: "success"
                });
            });
        },
        onSearch() {
            // this.searchList = [1,2,3,4,1,1,1,1,1]
            // removeCookie("token");
            // Pubsub.publish("showSearchDialog");
        }
    }
};
</script>

<style lang="scss" scoped>
.wrapper {
    display: flex;
    align-items: center;
}
.search-row {
    display: flex;
    margin-bottom: 30px;
}
.left-page {
    flex: 2;
    padding: 30px 30px 20px 20px;

    .cell-row {
        display: flex;
        margin-bottom: 20px;
        &:last-child {
            margin-bottom: 0;
        }
    }
}
.right-page {
    flex: 1;
    background: #fff;
    padding: 25px 30px 0 30px;
}
</style>
